package com.shelpe.services.sinbad.entity.jpa;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat.Shape;
import com.shelpe.services.sinbad.entity.jpa.UserLevelReport.PrimaryKey;

import lombok.Data;

@Entity(name = "rpt_customer")
@Data
@IdClass(PrimaryKey.class)
public class UserLevelReport {

	@Id
	@Column(name = "taobao_user_id")
	private long userID;
	@Id
	@JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd")
	private Date date;
	@Id
	private int source;

	private int impressions;// 展现量
	private int aclick;
	private BigDecimal cpm = BigDecimal.ZERO;
	private int click;// 点击量
	private int cost;// 花费（分）
	private int directPay;// 直接成交金额
	private int indirectPay;// 间接成交金额
	private int directPayCount;// 直接成交笔数
	private int indirectPayCount;// 间接成交笔数
	private int favItemCount;// 宝贝收藏数
	private int favShopCount;// 店铺收藏数
	private BigDecimal ctr = BigDecimal.ZERO;// 点击率
	private BigDecimal cpc = BigDecimal.ZERO;// 平均点击花费

	@Data
	public static class PrimaryKey implements Serializable {
		private static final long serialVersionUID = 1L;
		@Id
		@Column(name = "taobao_user_id")
		private long userID;
		@Id
		private Date date;
		@Id
		private int source;

		public PrimaryKey() {
		}

		public PrimaryKey(long id, Date date) {
			this.userID = id;
			this.date = date;
		}
	}
}
